//
//  SpotPtiorityViewController.m
//  DigiOps
//
//  Created by app on 2018/7/26.
//  Copyright © 2018年 俞渊华. All rights reserved.
//

#import "SpotPtiorityViewController.h"

@interface SpotPtiorityViewController ()
@property(nonatomic, strong)UITableView *tableView;
@property(nonatomic, strong)NSMutableArray *scoreArray;
@end

@implementation SpotPtiorityViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self.view addSubview:self.tableView];
    
    //默认block方法：设置上拉加载更多
}
-(void)viewDidLayoutSubviews{
    [super viewDidLayoutSubviews];
    self.scoreArray=[NSMutableArray new];
    self.scoreArray=@[@"优先级高",@"优先级普通"];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self.view);
    }];
}


-(void)searchAticle{
    
}



-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.scoreArray.count;
    //    return 10;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    UITableViewCell* cell=[[UITableViewCell alloc] init];
    cell.textLabel.text=[self.scoreArray objectAtIndex:indexPath.row];
    cell.textLabel.textAlignment = NSTextAlignmentCenter;//文字居中
    //    cell.model=[RouteModel new];
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    //    AticleModel * model = self.aticleArray[indexPath.row];
    //    if (model.ViewType == 1) {
    //        return [HomeBaseCell heightWithModel:model];
    //
    //    }else if (model.ViewType == 2) {
    //        return [HomeOneImageCell heightWithModel:model];
    //
    //    }else if (model.ViewType == 3){
    //        return [NewsMoreImageCell heightWithModel:model];0
    //    }else if (model.ViewType == 4){
    //        return [HomeOneImageCell heightWithModel:model];
    //    }
    return 60;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (self.block1) {
        [self.rt_navigationController popViewControllerAnimated:YES];
        self.block1([self.scoreArray objectAtIndex:indexPath.row]);
    }
    /*
     NewsDetailViewController * detailVC = [[NewsDetailViewController alloc]init];
     detailVC.model = self.aticleArray[indexPath.row];
     [self.rt_navigationController pushViewController:detailVC animated:YES];
     */
    //    DetailViewController * detailVC = [[DetailViewController alloc]init];
    //    //    detailVC.model = self.aticleArray[indexPath.row];
    //    [self.rt_navigationController pushViewController:detailVC animated:YES];
}


- (UITableView *)tableView{
    if (!_tableView) {
        UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
        tableView.delegate = self;
        tableView.dataSource = self;
        tableView.tableFooterView = [UIView new];
        UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 50)];
        view.backgroundColor = XMColor(241, 245, 247);
        UILabel* titleLabel = [[UILabel alloc]init];
        titleLabel.font = [UIFont xm_medium:17.0];
        titleLabel.numberOfLines = 1;
        titleLabel.textColor = [UIColor xm_jetblackColor];
        titleLabel.text=@"审查通用";
        
        [view addSubview:titleLabel];
        //        tableView.tableHeaderView=view;
        
        UIView * viewFoot = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 50)];
        viewFoot.backgroundColor = [UIColor whiteColor];
        UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
        //        button.frame = CGRectMake(40, 100, SCREEN_WIDTH- 80, 30);
        button.backgroundColor = [UIColor lightGrayColor];
        [button setTitle:@"提交" forState:UIControlStateNormal];
        [button addTarget:self action:@selector(submitRoute) forControlEvents:UIControlEventTouchUpInside];
        [viewFoot addSubview:button];
        //        tableView.tableFooterView=viewFoot;
        //        [button setImage:[UIImage imageNamed:@"image"] forState:UIControlStateNormal];
        //        [button setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
        //        [button setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
        
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(view).offset(18);
            make.left.equalTo(view.mas_left).offset(20);
        }];
        
        [button mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.equalTo(viewFoot).offset(0);
            //            make.top.equalTo(view).offset(5);
            make.width.mas_equalTo(SCREEN_WIDTH-80);
            make.height.mas_equalTo(30);
            //            make.left.equalTo(view.mas_left).offset(20);
        }];
        _tableView = tableView;
    }
    return _tableView;
}
-(void)submitRoute
{
    
}

@end
